<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.thymeleaf.org ">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>云研发平台 - 会员列表</title>
    <link rel="shortcut icon" href="favicon.ico" />
    <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet" />
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet" />
    <link href="css/plugins/iCheck/custom.css" rel="stylesheet" />
    <link href="css/animate.css" rel="stylesheet" />
    <link href="css/style.css?v=4.1.0" rel="stylesheet" />
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>云研发平台-会员列表</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="table_basic.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="table_basic.html#">选项1</a>
                            </li>
                            <li><a href="table_basic.html#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-9 m-b-xs">
                            <button type="button" class="btn btn-sm btn-danger">批量删除</button>
                            <button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#myModal2">添加会员</button>
                        </div>

                        <div class="col-sm-3">
                            <div class="input-group">
                                <input type="text" placeholder="请输入用户名、邮箱、电话" class="input-sm form-control" /> <span class="input-group-btn">
                                        <button type="button" class="btn btn-sm btn-primary"> 搜索</button> </span>
                            </div>
                        </div>
                    </div>
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th><input type="checkbox" name="" value="" /></th>
                                <th>ID</th>
                                <th>用户名</th>
                                <th>性别</th>
                                <th>手机</th>
                                <th>邮箱</th>
                                <th>地址</th>
                                <th>加入时间</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="member,iterStat:${resultMap.dataMap.members}">
                                <td><input type="checkbox" th:value="${member.id}" name="id" /></td>
                                <td th:text="${member.id}">1</td>
                                <td><u style="cursor:pointer" class="text-primary" onclick="member_show('张三','member-show.html','10001','360','400')">
                                    <th:block th:text="${member.memberName}"></th:block>
                                </u></td>
                                <td th:text="${member.memberSex}">男</td>
                                <td th:text="${member.memberPhone}">13000000000</td>
                                <td th:text="${member.memberMail}">admin@mail.com</td>
                                <td class="text-l" th:text="${member.memberAddress}">北京市 海淀区</td>
                                <td th:text="${#dates.format(member.memberJoinTime,'yyyy-MM-dd HH:mm:ss')}">2014-6-11 11:11:42</td>
                                <td class="td-status">
                                    <span th:text="${member.memberState==1?'已启用':'未启用'}" th:class="${member.memberState==1?'label label-success radius':'label label-warning radius'}">已启用</span></td>
                                <td class="td-manage">
                                    <a style="text-decoration:none"
                                       th:onclick="'disableMember(\''+${member.id}+'\')'" href="javascript:;" th:title="${member.memberState==0?'启用':'停用'}">
                                        <i th:class="${member.memberState==0?'fa fa-check text-navy':'fa fa-close text-navy'}"></i>
                                    </a>
                                    <a title="编辑" href="javascript:;" onclick="member_edit('编辑','/member-add','4','','510')" class="ml-5" style="text-decoration:none"><i class="fa fa-exchange text-navy"></i>
                                    </a>
                                    <a style="text-decoration:none" class="ml-5"
                                        href="javascript:;" title="修改密码" data-toggle="modal" data-target="#myUpdateModal"><i class="fa fa-question-circle text-navy"></i>
                                    </a>
                                    <a title="删除" th:onclick="'member_del(\''+${member.id}+'\',\''+this+'\')'" class="ml-5" style="text-decoration:none"><i class="fa fa-remove text-warning"></i></a>
                                </td>
                            </tr>

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<!--会员密码修改模态框 -->
<div class="modal inmodal" id="myUpdateModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated flipInY">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">修改会员密码</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal m-t" id="updateModalForm" method="post" th:object="${memberEntity}">


                    <div class="form-group">
                        <label class="col-sm-3 control-label">原始密码：</label>
                        <div class="col-sm-8">
                            <input id="yuanshipassword" name="yuanshipassword" class="form-control" type="password" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">新密码：</label>
                        <div class="col-sm-8">
                            <input id="new_password" name="new_password" class="form-control" type="password" />
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请再次输入您的密码</span>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="submit();">提交</button>
            </div>
        </div>
    </div>
</div>






<!--模态框 -->
<div class="modal inmodal" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated flipInY">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">会员添加</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal m-t" id="signupForm" th:action="@{/memberAdd}" method="post">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">用户名：</label>
                        <div class="col-sm-8">
                            <input id="memberName" name="memberName" class="form-control" type="text" />
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 这里写点提示的内容</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">手机号：</label>
                        <div class="col-sm-8">
                            <input id="memberPhone" name="memberPhone" class="form-control valid" type="text" aria-required="true" aria-invalid="false" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">住址：</label>
                        <div class="col-sm-8">
                            <input id="memberAddress" name="memberAddress" class="form-control valid" type="text" aria-required="true" aria-invalid="false"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">密码：</label>
                        <div class="col-sm-8">
                            <input id="password" name="password" class="form-control" type="password" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">确认密码：</label>
                        <div class="col-sm-8">
                            <input id="confirm_password" name="confirm_password" class="form-control" type="password" />
                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请再次输入您的密码</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">E-mail：</label>
                        <div class="col-sm-8">
                            <input id="memberEmail" name="memberEmail" class="form-control" type="email" />
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="submit();">提交</button>
            </div>
        </div>
    </div>
</div>






<!-- 全局js -->
<script src="js/jquery.min.js?v=2.1.4"></script>
<script src="js/bootstrap.min.js?v=3.3.6"></script>

<!-- jQuery Validation plugin javascript-->
<script src="js/plugins/validate/jquery.validate.min.js"></script>
<script src="js/plugins/validate/messages_zh.min.js"></script>
<script src="js/member/form-validate-member.js"></script>

<!-- Peity -->
<script src="js/plugins/peity/jquery.peity.min.js"></script>

<!-- 自定义js -->
<script src="js/content.js?v=1.0.0"></script>


<!-- iCheck -->
<script src="js/plugins/iCheck/icheck.min.js"></script>

<!-- Peity -->
<script src="js/demo/peity-demo.js"></script>
<script th:inline="javascript">
    /*<![CDATA[*/
    $(document).ready(function () {
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
    });

    function submit() {
        $("#signupForm").submit();
    }

    function member_del(id,a){
        var url = "/memberDelete";
        $.post(url, {id:id},function (data) {
            alert(data);
        });
        window.location.reload();
    }

    //修改密码
    function change_password (id) {
        var url = "/memberUpdate";
        $.post(url, {id:id},function (data) {
            //打开一个弹出框
            alert("我是同过id获取的数据"+data);
            openUpdateModal(data);
        });
    }

   $('[data-toggle="myUpdateModal"]').on('click',function (e) {
       $('#myUpdateModal').remove();
       e.preventDefault();
       var $this=$(this);
       $remote=$this.data('remote')||$this.attr('href');
       $modal=$('<div class="modal" id="myUpdateModal"> <div class="modal-body"></div></div>');
       $('body').append($modal);
       $modal.modal({backdrop:'static',keyboard:false});
       $modal.load($remote);
   });

    //停用操作
    function disableMember(id) {
        alert(id);
        //後臺陸空
        var url = "/disableMember";
        url = url+"?id="+id;
        url = encodeURI(url);
        window.location.href = url;

    }




    /*]]>*/
</script>
</body>
</html>
